home *** CD-ROM | disk | FTP | other *** search
/ Dave Lowe: AssemPro For Development Amiga Driver / Lowe_AssemProForDevelopmentAmigaDriver.adf / Empty / Back-up of amdriver.asm < prev    next >
Encoding:
Assembly Source File  |  1987-06-04  |  9.0 KB  |  390 lines

  1.  
  2. ;    notetable
  3.  
  4. a02    equ   508
  5. Bb02   equ   480
  6. b02    equ   453
  7. c02    equ   428
  8. Db02   equ   404
  9. d02    equ   381
  10. eb02   equ   360
  11. e02    equ   339
  12. f02    equ   320
  13. gb02   equ   302
  14. g02    equ   285
  15.  
  16. a01    equ   254
  17. Bb01   equ   240
  18. b01    equ   226
  19. c01    equ   214
  20. Db01   equ   202
  21. d01    equ   190
  22. eb01   equ   180
  23. e01    equ   170
  24. f01    equ   160
  25. gb01   equ   151
  26. g01    equ   143
  27.  
  28.  
  29.  
  30. chann1reg      equ  $dff0a0       ;start of ch1 registers
  31. dmacon         equ  $dff096
  32. int_bf_int     equ     $dff01e
  33. int_bf_w       equ     $dff09c
  34. in_line        equ     0
  35. new_snd        equ     4
  36. sreset          equ     1
  37.  
  38. end_patt       equ     8
  39. cr             equ     16
  40.  
  41.  
  42.  
  43.                move.w #1,d0
  44.                andi.w #0,d0
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. ;     a0 points to channel vars
  53. ;     a1 reads  patt data/song data/envelope data
  54. ;     a2 points to ch reg locations
  55. ;     d0 used as general purpose register
  56. ;     d1 holds bits set for dma control reg
  57.  
  58.  
  59.  
  60.  
  61.  
  62. testloop:      jsr driver
  63.                jsr delay
  64.                bra  testloop
  65.  
  66. tstop:          nop
  67.                nop
  68.                nop
  69.                nop
  70.  
  71.  
  72.  
  73.  
  74.  
  75. delay:
  76. ddd:               move.w $dff006,d0
  77. ;               andi.w #%0000000011111111,d0
  78. ;               cmpi #0,d0
  79. ;               bne ddd
  80. ;                rts
  81.  
  82.  
  83.  
  84.  
  85.  
  86.                move.l #$06ff,d7
  87. delloop:       subq.l #$1,d7
  88.                cmpi.l #50,d7
  89.                bls findel
  90.                bra delloop
  91. findel:        rts
  92.  
  93. driver:
  94.       lea ch1vars,a0
  95.       lea chann1reg,a2
  96.       move.w #%1000001000000001,d1  ; enable ch 1
  97.       move.w #%0000000000000000,d2
  98.  
  99. ;        *****************************
  100. ;  this section checks channel current status
  101.  
  102. sect1:
  103.                cmpi.w #0,(a0)        ; for test disable
  104.                beq sect1_j1
  105.                rts
  106. sect1_j1       cmpi.w #0,2(a0)        ;counter at zero
  107.                beq sect3             ; get new note
  108.                cmpi.w #1,2(a0)
  109.                beq sect4
  110.  
  111.                cmpi.w #3,4(a0)        ;is it looped data
  112.                bhs sect2              ;branch if one shot
  113.         ; data is looped data
  114. mode_switch:   subq #1,2(a0)          ;decrease counter
  115.                move.l 18(a0),a1        ;envelope data needed ?
  116.                cmpi.w #255,(a1)
  117.                beq env_finished
  118.                move.w (a1)+,8(a2)     ;send vol data
  119.                move.l a1,18(a0)       ;store pointer
  120. env_finished:  rts                    ; finish
  121.  
  122. ;         *****************************
  123. ; this section checks 4(a0) and if it is 2 then it sends the one shot
  124. ; data in the vars buffer and sets 4(a0) to 3
  125. ; when flag is 3 the program sends the loop data to the reg and sets
  126. ; the flag to 4
  127. ; when the flag is 4 it checks the block finished interrupt and when
  128. ; set it sets the flag to 1 and jumps to mode_switch where the loop
  129. ; data is processed normally
  130. ; new note must check the flag 4(a0) and if it is 1 then reset it 2
  131. ;
  132.  
  133. ;      flag must be 3 or 4
  134. sect2:
  135.                cmpi.w #4,4(a0)
  136.                beq part3        ;to check for block finished
  137.                bra part2        ;flag is 3,send loop data
  138. ;    part 1 send one shot data to chip
  139. one_shot_note: move.w  #3,4(a0)         ;set flag
  140.                move.l 38(a0),(a2)
  141.                move.w 42(a0),4(a2)
  142.                move.w #64,8(a2)
  143.                move.w d1,dmacon         ;start dma
  144.                rts
  145. ;    part 2 send loop data to chip
  146.  ;  move loop  data into register  from vars store
  147. part2:                                                  
  148. notyet:  
  149. ;               move.w 8(a0),d0       ;int mask bit
  150. ;               and int_bf_int,d0
  151. ;               cmpi.w #0,d0
  152. ;               beq notyet
  153. ;               move.w d0,int_bf_w
  154.  
  155.                move.w  #4,4(a0)      ;flag to 4
  156.                move.l 44(a0),(a2)
  157.                move.w 48(a0),4(a2)
  158.                subq #1,2(a0)           ;decrease count
  159.                rts
  160.  
  161. part3:   ;      clr.l d0
  162.          ;      move.w 8(a0),d0
  163.          ;      and int_bf_int,d0
  164.          ;      cmpi #0,d0
  165.  
  166. ;               bset  d0,int_bf_int    ;test int set
  167. ;               bne block_done
  168.                                   ;  block still playing
  169.                subq #1,2(a0)      ;dec count
  170.                rts
  171.  
  172.  
  173. block_done:    move.w #1,4(a0)   ;   flag to loop
  174.                bra mode_switch
  175.  
  176.  
  177.  
  178. ;          *****************************
  179.  
  180. ; this section gets new note data
  181.  
  182. sect3:
  183. ;               move.w 8(a0),d0
  184. ;               move.w d0,int_bf_w
  185.  
  186.                move.l 22(a0),a1     ;get patt pointer
  187. control_ret:   move.w (a1)+,d0       ;next data to d0/pointer inc
  188.                cmpi.w #100,d0         ;control marker
  189.                bls  sect5            ;effects flags
  190.        ;d1 holds next note pitch
  191.                move.w d0,12(a0)     ;store in curr pitch
  192.               move.w d0,6(a2)      ;pitch to reg
  193.                move.w (a1)+,2(a0)   ;store count
  194.                subq.w #1,2(a0)      ;and decrease
  195.                move.l a1,22(a0)     ;store patt pointer
  196.                move.l 34(a0),18(a0) ; reset env pointer
  197. ;               move.w #64,8(a2)
  198.  
  199.                cmpi.w #0,4(a0)
  200.                beq do_loop
  201.                bra one_shot_note              ;jump there
  202.  
  203.  ;     loop data trigger
  204. do_loop:       move.w d1,dmacon     ;start dma for current channel
  205.                rts
  206.  
  207.  
  208.       ;      ***********************************
  209. sect4:
  210.  
  211.  
  212.  
  213.                move.w #%0000000000000001,dmacon     ;dma off
  214.                subq.w #1,2(a0)
  215.                rts
  216.  
  217.       ;      ***********************************
  218.       ;  effects flags  d0 holds jump offset
  219. sect5:          move.l #jump_table,a3
  220.                 move.l (a3,d0),a4
  221.                 jmp (a4)
  222.  
  223.  
  224. jump_table:     defl   in_line_data
  225.                 defl   nsound
  226.                 defl   patt_end
  227.                 nop
  228.                 nop
  229. in_line_data:
  230. ;             data format = reg offset,data,etc....,end_data
  231.                nop
  232.                rts
  233.  
  234.  
  235.  
  236. nsound:        move.l (a1)+,a3          ;sound address to a3
  237.                cmpi.w #0,(a3)
  238.                bne one_shot_sound
  239.                move.w (a3)+,4(a0)       ;loop or one shot flag
  240.                move.l (a3)+,(a2)          ;data address
  241.                move.w (a3),4(a2)       ;length
  242.                jmp control_ret
  243.  
  244. one_shot_sound:
  245.                move.w (a3)+,4(a0)
  246.                move.l (a3)+,38(a0)     ;store
  247.                move.l (a3)+,42(a0)
  248.                move.l (a3),46(a0)
  249.                jmp control_ret
  250.  
  251. patt_end:
  252. ;      get next patt address from song part
  253.                move.l 26(a0),a1        ;song pos to a1
  254. song_cont_ret:  cmpi.l #0,(a1)          ;song marker ??
  255.                beq song_control
  256.                addq.l  #4,a1
  257.                move.l a1,26(a0)        ;store song pointer
  258.                move.l (a1),a1          ;patt address to a1
  259.                jmp control_ret
  260.  
  261.  
  262. song_control:
  263. ;    reset song to start
  264.                 addq.l #4,a1
  265.                 cmpi.l #255,(a1)
  266.                 beq tstop
  267.                 move.l 30(a0),a1
  268.                 bra song_cont_ret
  269.  
  270.  
  271.  
  272.  
  273. ch1vars         defw 0         ; test disable           +0
  274.                 defw 0         ; interrupt counter      +2
  275.                 defw 0         ; 1 = loop/one shot mode flag +4
  276.                 defw 0         ; current pitch          + 6
  277.  
  278.                 defw %0000000010000000        ;bit number for int read
  279.                 defw 0        ;
  280.                 defw 0        ;
  281.                 defw 0        ;
  282.                 defw 0        ;
  283.  
  284.                 defl env1     ; env pointer            +18
  285.                 defl p1       ; patt pointer          +22
  286.                 defl s1        ; curr song pointer     +26
  287.                 defl s1        ; reset song pointer    +30
  288.                 defl env1      ; reset env pointer     +34
  289. ;  section used to store current sound data
  290.  
  291.                defl 0         ; one shot data  address  +38
  292.                 defw 0        ; one shot data length    +42
  293.                 defl 0        ; loop data address       +46
  294.                 defw 0        ; loop data length        +50
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304. s1:            defl p1,p1,p1,0,sreset
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312. p1:            defw new_snd
  313.                defl snd2
  314.                defw  d02,cr,d02,cr,d02,cr,d02,cr/2,d02,cr/2
  315.                defw  d02,cr,d02,cr,d02,cr,d02,cr/2,d02,cr/2
  316.                defw  b02,cr,d02,cr,a02,cr,b02,cr/2,d02,cr/2
  317.                defw  c02,cr,d02,cr,a02,cr,g02,cr/2,d02,cr/2
  318.                defw end_patt
  319.  
  320.  
  321.  
  322.  
  323.  
  324. snd1       defw 0   ;loop data
  325.            defl sda    ;data address
  326.            defw 16  ;length
  327.  
  328. snd2       defw 1   ;one_shot_flag
  329.            defl koto1
  330.            defw 1280 ;length
  331.            defl rest_data    ;data address
  332.            defw 16     ;length
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340. sda:       defb 0,90,127,-90,-127,-90
  341.            defb 0,90,127,-90,-127,-90
  342.            defb 0,90,127,-90,-127,-90
  343.            defb 0,90,127,-90,-127,-90
  344.            defb 0,90,127,-90,-127,-90
  345.            defb 0,90,127,-90,-127,-90
  346.            defb 0,90,127,-90,-127,-90
  347.  
  348.  
  349.  
  350.  
  351. rest_data:
  352. ;          length=24 words
  353.            defw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  354.  
  355. env1:      defw 64,64,64,64,22,20,20,20,20,20,10,10,0
  356.            defw 12,20,24,26,30,40,50,60,255
  357.  
  358.                align.w
  359. koto1:
  360.                ibytes koto1
  361.  
  362.  
  363.  
  364.  
  365.                            end
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.